﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;

using Ycg.Windows;

namespace Ycg.Logging
{
    [Serializable]
    public class LogInfo
    {
        private DateTime _currentDateTime = DateTime.Now;
        private string _threadName = Thread.CurrentThread.Name;
        private string _machineName = Environment.MachineName;
        private int _threadID = Thread.CurrentThread.ManagedThreadId;
        private string _appDomainName = AppDomain.CurrentDomain.FriendlyName;  //其实就是应用程序域的名称
        private string _applicationName = Process.GetCurrentProcess().ProcessName;
        private string _currentProcessID = WindowsAPI.GetCurrentProcessId().ToString(CultureInfo.InvariantCulture);

        public LogInfo()
        {
        }

        public LogInfo(LogLevel logLevel)
        {
            this.LogLevel = logLevel;
        }

        public DateTime Date
        {
            get { return this._currentDateTime; }
        }

        public int ThreadID
        {
            get { return this._threadID; }
            set { this._threadID = value; }
        }

        public string ThreadName
        {
            get { return this._threadName; }
            set { this._threadName = value; }
        }

        public string MachineName
        {
            get { return this._machineName; }
            set { this._machineName = value; }
        }

        public string ApplicationName
        {
            get { return this._applicationName; }
            set { this._applicationName = value; }
        }

        public string CalssName { get; set; }

        public string ModuleName { get; set; }

        public string MethodName { get; set; }

        public string Message { get; set; }

        public string StackTrace { get; set; }

        public LogLevel LogLevel { get; set; }

        public string VersionNumber { get; set; }
    }
}
